package com.shootingGame.weaponsClasses.ordinance
{
	import com.shootingGame.physics.collisionReactionClasses.base.CollisionEffects;
	import com.shootingGame.renderableClasses.GameObject;
	import com.shootingGame.weaponsClasses.WeaponInfo;

	public class SimpleBulletOrdinance extends Ordinance
	{	
		public static var cachedList : Array = new Array();
		
		public function SimpleBulletOrdinance(owner : GameObject, weaponInfo : WeaponInfo, collisionEffects:CollisionEffects = null, sourceX:Number = 0, sourceY:Number = 0, targetX:Number = 0, targetY:Number = 0, travelDirection:Number = 0, travelSpeedModifier:Number = 1, liveTime : int = 500)
		{
			super(new SimpleBulletType1(), owner, weaponInfo, sourceX, sourceY, targetX, targetY, collisionEffects, travelDirection, 1, travelSpeedModifier, liveTime);
		}

		override public function clone():Ordinance{
			super.clone();
			var cachedItem:Ordinance;
			if(cachedList.length > 0){
				cachedItem = cachedList.pop();
				cachedItem.isExpired = false;
				cachedItem.reset();
				return cachedItem;
			}
			else
				return new SimpleBulletOrdinance(owner, weaponInfo);
		}
		
		override protected function cache():void{
			cachedList.push(this);
		}		
	}
}
